Skip to content

[libc] Fix utimes build when full_build=OFF #149668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2025

Conversation

mikhailramalho
Copy link
Member

Same as PR #149665: we might pull a header from the host where tv_nsec is not a long, so compilation would fail with an implicit conversion error.

Same as PR llvm#149665: we might pull a header from host where tv_nsec is
not a long, so compilation would fail with an implicit conversion error.
@llvmbot
Copy link
Member

llvmbot commented Jul 19, 2025

@llvm/pr-subscribers-libc

Author: Mikhail R. Gadelha (mikhailramalho)

Changes

Same as PR #149665: we might pull a header from the host where tv_nsec is not a long, so compilation would fail with an implicit conversion error.


Full diff: https://github.com/llvm/llvm-project/pull/149668.diff

1 Files Affected:

  • (modified) libc/src/sys/time/linux/utimes.cpp (+2-2)
diff --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp
index ed37b42aedf6c..36220d73e7c19 100644
--- a/libc/src/sys/time/linux/utimes.cpp
+++ b/libc/src/sys/time/linux/utimes.cpp
@@ -59,8 +59,8 @@ LLVM_LIBC_FUNCTION(int, utimes,
     ts[1].tv_sec = times[1].tv_sec;
 
     // convert u-seconds to nanoseconds
-    ts[0].tv_nsec = times[0].tv_usec * 1000;
-    ts[1].tv_nsec = times[1].tv_usec * 1000;
+    ts[0].tv_nsec = static_cast<decltype(ts[0].tv_nsec)>(times[0].tv_usec * 1000);
+    ts[1].tv_nsec = static_cast<decltype(ts[1].tv_nsec)>(times[1].tv_usec * 1000);
 
     ts_ptr = ts;
   }

Copy link

github-actions bot commented Jul 19, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Signed-off-by: Mikhail R. Gadelha <[email protected]>
@mikhailramalho mikhailramalho merged commit 5753be4 into llvm:main Jul 19, 2025
23 of 24 checks passed
@mikhailramalho mikhailramalho deleted the libc-fix-utimes branch July 19, 2025 19:37
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
We might pull a header from the host where tv_nsec is not a long, 
so compilation would fail with an implicit conversion error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants